//
//  StudyHeaderView.swift
//  ExList
//
//  Created by qmsoft_macmini on 16/6/23.
//  Copyright © 2016年 qmsoft_macmini. All rights reserved.
//

import UIKit

protocol StudyHeadDelegate {
    func clickHead(section:Int)
}

class StudyHeaderView: UITableViewHeaderFooterView {

    @IBOutlet weak var txt_name: UILabel!
    var section:Int!
    var studyHead: StudyHeadDelegate?
    override func awakeFromNib() {
        // 单击手势识别
        let tapGesture = UITapGestureRecognizer(target: self, action: #selector(StudyHeaderView.clickHead(_:)))
        self.addGestureRecognizer(tapGesture)
        //长按手势
        let longpressGesutre = UILongPressGestureRecognizer(target: self, action: #selector(StudyHeaderView.handleLongpressGesture(_:)))
        //长按时间为1秒
        longpressGesutre.minimumPressDuration = 1
        //允许15秒运动
        longpressGesutre.allowableMovement = 15
        //所需触摸1次
        longpressGesutre.numberOfTouchesRequired = 1
        self.addGestureRecognizer(longpressGesutre)
    }

    func clickHead(gestureRecognizer: UIGestureRecognizer) {
        studyHead?.clickHead(section)
    }
    
    func handleLongpressGesture(sender: UILongPressGestureRecognizer) {
        print("===========长按了")
    }
}
